package com.spring.cloud.mapper

import com.spring.cloud.module.UserInfo
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Select

@Mapper
interface UserInfoMapper {


    @Select("""<script>
        select userId,username,password,deleted from p_user where 1=1
        <if test="username != null"> and username like #{username}%</if>
        <if test="userId !=null"> and userId =#{userId}</if>
        <if test="deleted !=null"> and deleted =#{deleted}</if>
        </script>
    """)
    fun queryUserList(userInfo: UserInfo):List<UserInfo>

    @Insert("""
        INSERT INTO p_user
            (username, `password`, deleted)
        VALUES (#{username}, #{password}, #{deleted})
    """)
    fun insertUserInfo(userInfo: UserInfo) :Int
}